<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form>
        <label for="stu_id">学号：</label>
        <input id="stu_id" type="text"><br>
        姓名：<input class="stu_name" type="text"><br>
        语文：<input class="Chinese" type="text"><br>
        数学：<input class="math" type="text"><br>
        英语：<input class="English" type="text"><br>
        理综:<input class="lizong" type="text"><br>
        文综：<input class="wenzong" type="text"><br>
    </form>
    <button class="btn_student_results">提交学生信息</button>
    <script src="../jquery/jquery-1.12.4.min.js"></script>
    <script>
       
        $('.btn_student_results').click((e)=>{
            // form表单有浏览器的默认提交功能
            // console.log('xxx');
            // file:///D:/a-jinsi-courseware/1.class%20course/4.w2203A/7.node/%E5%AD%A6%E7%94%9F%E7%AE%A1%E7%90%86/student_gl_2203/public/students.html?
            e.preventDefault();
            // jquery发送ajax请求 post 
            $.ajax({
                method:'post',
                url:'http://localhost:3000/end-exam',
                data:{
                    stu_id:$('#stu_id').val(),
                    stu_name:$('.stu_name').val(),
                    Chinese:$('.Chinese').val(),
                    math:$('.math').val(),
                    English:$('.English').val(),
                    lizong:$('.lizong').val(),
                    wenzong: $('.wenzong').val(),
 
                },
                success:(data)=>{
                    console.log(data);
                },
                error:(err)=>{
                    console.log(err);
                }
            })


        })
</script>
</body>
</html>